package com.mineoj.model.vo;

import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.mineoj.model.dto.question.JudgeConfig;
import com.mineoj.model.entity.Question;
import com.mineoj.model.entity.Solution;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 题解封装类

 */
@Data
public class SolutionVO implements Serializable {
    /**
     * id
     */

    private Long id;

    /**
     * 标题
     */
    private String title;

    /**
     * 内容
     */
    private String content;

    /**
     * 题目 id
     */
    private Long questionId;

    /**
     * 点赞数
     */
    private Integer thumbNum;

    /**
     * 评论数
     */
    private Integer commentNum;

    /**
     * 创建用户 id
     */
    private Long userId;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 是否删除
     */
    private Integer isDelete;

    /**
     * 创建用户信息
     */
    private UserVO userVO;

    /**
     * 是否已点赞
     */
    private Boolean hasThumb;


    /**
     * 包装类转对象
     *
     * @param solutionVO
     * @return
     */
    public static Solution voToObj(SolutionVO solutionVO) {
        if (solutionVO == null) {
            return null;
        }
        Solution solution = new Solution();
        BeanUtils.copyProperties(solutionVO, solution);

        return solution;
    }

    /**
     * 对象转包装类
     *
     * @param solution
     * @return
     */
    public static SolutionVO objToVo(Solution solution) {
        if (solution == null) {
            return null;
        }
        SolutionVO solutionVO = new SolutionVO();
        BeanUtils.copyProperties(solution, solutionVO);

        return solutionVO;
    }

    private static final long serialVersionUID = 1L;
}